﻿/// <reference path="../libs/underscore.js" />
/// <reference path="../libs/angular.js" />
function showGallery() {


    //jQuery(document).ready(function () {
    //    //hide a div after 3 seconds
    //    setTimeout("jQuery('#div').hide();", 3000);
    //});


    if ($('#myGallery')) {
       // $('#myGallery').hide();
        //alert("kurec");
        setTimeout(function () {
            $('#myGallery').show();
            $('#myGallery').spacegallery({ loadingClass: 'loading' });
   
        }, 50);
          
        }
    }

function showMap() {
    var map = $("#map-canvas");
    var isContact = window.location.href.indexOf("contact") >= 0;
    if (isContact) {
        map.show();
    }
    else {
        map.hide();
    }

    function initialize() {
        var mapOptions = {
            center: new google.maps.LatLng(42.6658758, 23.3182589),
            zoom: 15
        };
        var map = new google.maps.Map(document.getElementById("map-canvas"),
            mapOptions);

        var marker = new google.maps.Marker({
            position: new google.maps.LatLng(42.6658758, 23.3182589),
            map: map
        });
    }
    google.maps.event.addDomListener(window, 'load', initialize);
}

function makeSelected() {
    var anchors = $("ul > li > a");
    for (var a = 0; a < anchors.length; a++) {
       // if ($(anchors[a]).hasClass("selected")) {
            $(anchors[a]).removeClass("selected")
        //}
    }

    if (window.location.href.indexOf("contact") >= 0) {
        $("#nav-contacts").addClass("selected");
    }
    else if (window.location.href.indexOf("services") >= 0) {
        $("#nav-services").addClass("selected");
    }
    else if (window.location.href.indexOf("about") >= 0) {
        $("#nav-about").addClass("selected");
    }
    else {
        $("#nav-home").addClass("selected");
    }
};

//TODO: SAVE URL WHEN PASTED http://stackoverflow.com/questions/20789399/angularjs-dynamic-routes-without-hashtag

//angular.module("website", [])
//	.config(["$routeProvider", '$locationProvider', function ($routeProvider, $locationProvider) {
//	    $routeProvider.when("/", { templateUrl: "scripts/views/home.html", controller: HomeController });
//	    $routeProvider.when("/about", { templateUrl: "scripts/views/about.html", controller: AboutController });
//	    $routeProvider.when("/service/:alias", { templateUrl: "scripts/views/service.html", controller: SingleServiceController });
//	    $routeProvider.when("/services", { templateUrl: "scripts/views/services.html", controller: ServiceController });
//	    $routeProvider.when("/contact", { templateUrl: "scripts/views/contact.html", controller: ContactController })
//			.otherwise({ redirectTo: "/" });

//	    if (window.history && window.history.pushState) {
//	        $locationProvider.html5Mode(true);
//	    }
//	}]);


/*   ----   if want to use this add # to anchors!!!   ---   */
angular.module("website", [])
	.config(["$routeProvider", function ($routeProvider) {
	    $routeProvider
            .when("/", { templateUrl: "scripts/views/home.html", controller: HomeController })
            .when("/about", { templateUrl: "scripts/views/about.html", controller: AboutController })
            .when("/services/:alias", { templateUrl: "scripts/views/service.html", controller: SingleServiceController })
            .when("/services", { templateUrl: "scripts/views/services.html", controller: ServiceController })
            .when("/contact", { templateUrl: "scripts/views/contact.html", controller: ContactController })
			.otherwise({ redirectTo: "#/" });
	}]);


//angular.module('phonecat', []).
//  config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {

//      $routeProvider.
//        when('/phones', { templateUrl: 'partials/phone-list.html', controller: PhoneListCtrl }).
//        when('/phones/:phoneId', { templateUrl: 'partials/phone-detail.html', controller: PhoneDetailCtrl }).
//        otherwise({ redirectTo: '/phones' });

//      if (window.history && window.history.pushState) {
//          $locationProvider.html5Mode(true);
//      }

//  }]);